// ===============================================
// user_info_resp
//
// Create by Will on 2020/10/19 11:09 AM
// Copyright @data_food.All rights reserved.
// ===============================================

import 'package:flustars/flustars.dart';
import 'package:json_annotation/json_annotation.dart';
import 'app_user_info.dart';

/// This allows the `UserInfo` class to access private members in
/// the generated file. The value for this is *.g.dart, where
/// the star denotes the source file name.
part 'sign_in_user_info.g.dart';

/// An annotation for the code generator to know that this class needs the
/// JSON serialization logic to be generated.
@JsonSerializable()
class RespLoginUserInfo {
  final int userId;
  final String phone;
  final String qq;
  final String email;
  final String lcOpenId;
  final String wxOpenId;
  final String password;
  final String firstName;
  final String lastName;
  final String nickName;
  final int sex;
  final int age;
  final DateTime birthday;
  final double bodyTall;
  final String bodyType;
  final String academic;
  final int status;
  final String occupation;
  final String income;
  final int integral;
  final double balance;
  final int credit;
  final double longitude;
  final double latitude;
  final String addressCode;
  final String addressCode_Name;
  final String invitationCode;
  final DateTime lastLoginTime;
  final int loginTime;
  final DateTime createTime;
  final int userType;
  final String remark;
  // IM 的id
  final String imId;
  // IM密码
  final String imPassword;

  const RespLoginUserInfo(
      {this.userId,
      this.phone,
      this.qq,
      this.email,
      this.lcOpenId,
      this.wxOpenId,
      this.password,
      this.firstName,
      this.lastName,
      this.nickName,
      this.sex,
      this.age,
      this.birthday,
      this.bodyTall,
      this.bodyType,
      this.academic,
      this.status,
      this.occupation,
      this.income,
      this.integral,
      this.balance,
      this.credit,
      this.longitude,
      this.latitude,
      this.addressCode,
      this.addressCode_Name,
      this.invitationCode,
      this.lastLoginTime,
      this.loginTime,
      this.createTime,
      this.userType,
      this.remark,
      this.imId,
      this.imPassword});

  /// A necessary factory constructor for creating a new UserInfo instance
  /// from a map. Pass the map to the generated `_$UserInfoFromJson()` constructor.
  /// The constructor is named after the source class, in this case, UserInfo.
  factory RespLoginUserInfo.fromJson(Map<String, dynamic> json) =>
      _$RespLoginUserInfoFromJson(json);

  /// `toJson` is the convention for a class to declare support for serialization
  /// to JSON. The implementation simply calls the private, generated
  /// helper method `_$UserInfoToJson`.
  Map<String, dynamic> toJson() => _$RespLoginUserInfoToJson(this);

  AppUserInfoBuilder toAppUserInfoBuilder() {
    return AppUserInfoBuilder()
      ..userId = userId
      ..phone = phone
      ..qq = qq
      ..email = email
      ..lcOpenId = lcOpenId
      ..wxOpenId = wxOpenId
      ..password = password
      ..firstName = firstName
      ..lastName = lastName
      ..nickName = nickName
      ..sex = sex
      ..age = age
      ..birthday = DateUtil.formatDate(birthday, format: DateFormats.zh_y_mo_d)
      ..bodyTall = bodyTall
      ..bodyType = bodyType
      ..academic = academic
      ..status = status
      ..occupation = occupation
      ..income = income
      ..integral = integral
      ..balance = balance
      ..credit = credit
      ..longitude = longitude
      ..latitude = latitude
      ..addressCode = addressCode
      ..addressCode_Name = addressCode_Name
      ..invitationCode = invitationCode
      ..lastLogintime =
          DateUtil.formatDate(lastLoginTime, format: DateFormats.zh_y_mo_d)
      ..logintime = loginTime
      ..createTime =
          DateUtil.formatDate(createTime, format: DateFormats.zh_y_mo_d)
      ..userType = userType
      ..remark = remark
        ..imId = imId
        ..imPassword = imPassword;
  }
}
